//
//  ShellRateHeadView.m
//  ShellWallert
//
//  Created by lvzhao on 2019/9/27.
//  Copyright © 2019年 VV. All rights reserved.
//

#import "ShellRateHeadView.h"

@implementation ShellRateHeadView

- (instancetype)init
{
    self = [super init];
    if (self) {
        [self setupUI];
    }
    return self;
}


- (void)setupUI{
    
    self.backgroundColor = UIColorHex(0x031D32);
    ///!!!:货币
    UILabel *currencyLab = [UILabel lz_labelWithText:LZLocalizedString(@"货币") fontSize:k_textFont(14) color:UIColorHex(0x6699BF)];
    [currencyLab lz_centerAlignment];
    [self addSubview:currencyLab];
    [currencyLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.bottom.mas_equalTo(0);
        make.width.mas_equalTo(73);
    }];
    ///!!!:现汇/现金
    NSArray *typeTitles = @[@"现汇",@"现金"];
    CGFloat typeTitleW = (K_SCREENWIDTH - 73)/2.0;
    for(int i = 0; i < typeTitles.count; i++){
        
        UILabel *typeLabel = [UILabel lz_createLabWithTextColor:UIColorHex(0x6699BF) font:k_textFont(14)];
        [typeLabel lz_centerAlignment];
        typeLabel.text = LZLocalizedString(typeTitles[i]);
        [self addSubview:typeLabel];
        [typeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(0);
            make.left.mas_equalTo(currencyLab.mas_right).mas_equalTo(i * typeTitleW);
            make.width.mas_equalTo(typeTitleW);
            make.height.mas_equalTo(40);
        }];
    }
    
    
    NSArray *details= @[@"银行买入",@"银行卖出",@"银行买入",@"银行卖出"];
    CGFloat detailW = (K_SCREENWIDTH - 73)/4.0;
    for(int i = 0; i < details.count; i++){
        
        UILabel *detailLabel = [UILabel lz_createLabWithTextColor:UIColorHex(0x6699BF) font:k_textFont(14)];
        [detailLabel lz_centerAlignment];
        detailLabel.text = LZLocalizedString(details[i]);
        [self addSubview:detailLabel];
        [detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(41);
            make.left.mas_equalTo(currencyLab.mas_right).mas_equalTo(i * detailW);
            make.width.mas_equalTo(detailW);
            make.height.mas_equalTo(40);
        }];
    }
    ///!!!:线条
    UIView *topLineView = [[UIView alloc] init];
    topLineView.backgroundColor = COLOR_BACKGROUND;
    topLineView.frame = CGRectMake(0, 0, K_SCREENWIDTH, 1);
    [self addSubview:topLineView];
    
    UIView *hengLineView = [[UIView alloc] init];
    hengLineView.backgroundColor = COLOR_BACKGROUND;
    hengLineView.frame = CGRectMake(73, 41, K_SCREENWIDTH, 1);
    [self addSubview:hengLineView];
    
    for(int i = 0; i < 4; i++){
        
        UIView *lineView = [[UIView alloc] init];
        [self addSubview:lineView];
        lineView.backgroundColor = COLOR_BACKGROUND;
        [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            if(i % 2 == 0){
                make.top.mas_equalTo(0);
                make.height.mas_equalTo(82);
            } else {
                make.top.mas_equalTo(41);
                make.height.mas_equalTo(40);
            }
            make.left.mas_equalTo(currencyLab.mas_right).mas_equalTo(i * detailW);
            make.width.mas_equalTo(1);
        }];
    }
    
}

@end
